local kuanggu = fk.CreateSkill{
    name = "cpt11__kuanggu",
}

Fk:loadTranslationTable{
    ["cpt11__kuanggu"] = "狂骨",
    [":cpt11__kuanggu"] = "当你造成伤害后，若你已受伤，你可判定，若结果为黑色，你回复1点体力。",

    ["$cpt11__kuanggu1"] = "我会怕你吗！",
    ["$cpt11__kuanggu2"] = "真是美味啊！",
}

kuanggu:addEffect(fk.Damage, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(kuanggu.name) and (data.extra_data or {}).kuanggucheck and player:isWounded()
  end,
  on_use = function(self, event, target, player, data)
    local judge = {
          who = player,
          reason = kuanggu.name,
          pattern = ".",
    }
    player.room:judge(judge)
    if judge.card:getColorString() == "black" then
    player.room:recover{
      who = player,
      num = 1,
      recoverBy = player,
      skillName = kuanggu.name,
    }
   end
  end,
})

kuanggu:addEffect(fk.BeforeHpChanged, {
  can_refresh = function(self, event, target, player, data)
    return data.damageEvent and player == data.damageEvent.from
  end,
  on_refresh = function(self, event, target, player, data)
    data.damageEvent.extra_data = data.damageEvent.extra_data or {}
    data.damageEvent.extra_data.kuanggucheck = true
  end,
})

return kuanggu